package main
import(
	"fmt"
	"strconv"
)

func main(){
	// num1 := 99
	// num2 := 23.456
	// b := true
	// mycar := 'h'
	// var str string

	// // 使用第一种方式来转换
	// str = fmt.Sprintf("%d",num1)
	// fmt.Printf("str type is %T str =%q \n ",str, str)

	// str = fmt.Sprintf("%f",num2)
	// fmt.Printf("str type is %T str =%q \n ",str, str)
	
	// str = fmt.Sprintf("%t",b)
	// fmt.Printf("str type is %T str =%q \n ",str, str)
	
	// str = fmt.Sprintf("%c",mycar)
	// fmt.Printf("str type is %T str =%q \n ",str, str)

	
	var num3 int = 99
	var num4 float64 = 23.456
	var b2 bool = true
	var str string
	str = strconv.FormatInt(int64(num3), 10)
	fmt.Printf("str type is %T str =%q \n ",str, str)

	// strconv.FormatFolat(num4,'f',10,64)
	// 'f' 格式 10： 表示 小数位保留10位， 64 位：表示这个小数是float64
	str = strconv.FormatFloat(num4, 'f', 10, 64)
	fmt.Printf("str type is %T str =%q \n ",str, str)

	str = strconv.FormatBool(b2)
	fmt.Printf("str type is %T str =%q \n ",str, str)


	// strconv包中有一个函数 Itoa
	var num5 int64 = 4567
	str = strconv.Itoa(int(num5))
	fmt.Printf("str type is %T str =%q \n ",str, str)


}